;;; org2nikola --- Convert Org to HTML for static blog generator Nikola

;; Copyright (C) 2012-2020 Chen Bin
;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com>
;; URL: http://github.com/redguardtoo/org2nikola
;; Keywords: blog static html export org
;; Version: 0.2.1
;; Package-Requires: ((emacs "24.4"))

;;; License:

;; This file is part of evil-matchit
;;
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as published
;; by the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; evil-matchit is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Configuration:
;;
;; (add-to-list 'load-path "~/.emacs.d/lisp/nikola")
;; (require 'org2nikola)
;; (setq org2nikola-output-root-directory "~/.config/nikola")
;;
;;
;; Usage:
;;   - `M-x org2nikola-export-subtree` to create meta data
;;   - `nikola build' to create final html files
;;
;; You may `M-x org2nikola-rerender-published-posts' at least once
;; if you haven't published all post on one computer.
;;
;; Press `C-c C-c' or `M-x org-ctrl-c-ctrl-c' to tag the post.
;;
;; You can `(setq org2nikola-use-verbose-metadata t)` because nikola7.7
;; requires more verbose meta data.
;;
;; Tips:
;;  - use `org2nikola-process-output-html-function' to customize the final
;;    html output of blog post
;;  - use `org2nikola-after-hook' to push the updated blog post to ftp or
;;    git server
;;
;; Check  https://github.com/redguardtoo/org2nikola for more tips.
;;

;;; Code:
(require 'org)

(defvar org2nikola-output-root-directory nil)

(defvar org2nikola-org-blog-directory nil)

(defvar org2nikola-use-verbose-metadata nil
  "Produce more verbose metadata required by new version of nikola 7.7+.
`nikola plugin -i upgrade_metadata;nikola upgrade_metadata' to upgrade legacy metadata.")

(defvar org2nikola-prettify-unsupported-language
  '(conf "ini"
    rjsx "jsx"
    elisp "lisp"
    emacs-lisp "lisp")
  "Render unknown syntax in supported language syntax.")

(defvar org2nikola-process-output-html-function
  (lambda (html title post-slug)
    (ignore title post-slug)
    html)
  "Function used to customize the final output html.
Html output, title, and post slug is passed into it as parameters.
It should return the updated html.")

(defcustom org2nikola-after-hook nil
  "Hook after HTML files are created.  Title and slug are pass as parameters."
  :type 'hook
  :group 'org2nikola)

(defconst org2nikola-zh-char-table
  '(("a" "阿" "啊" "呵" "腌" "嗄" "锕" "吖")
    ("ai" "爱" "哀" "挨" "碍" "埃" "癌" "艾" "唉" "矮" "哎" "皑" "蔼" "隘" "暧" "霭" "捱" "嗳" "瑷" "嫒" "锿" "嗌" "砹")
    ("an" "安" "案" "按" "暗" "岸" "俺" "谙" "黯" "鞍" "氨" "庵" "桉" "鹌" "胺" "铵" "揞" "犴" "埯")
    ("ang" "昂" "肮" "盎")
    ("ao" "奥" "澳" "傲" "熬" "敖" "凹" "袄" "懊" "坳" "嗷" "拗" "鏖" "骜" "鳌" "翱" "岙" "廒" "遨" "獒" "聱" "媪" "螯" "鏊")
    ("ba" "把" "八" "吧" "巴" "爸" "罢" "拔" "叭" "芭" "霸" "靶" "扒" "疤" "跋" "坝" "笆" "耙" "粑" "灞" "茇" "菝" "魃" "岜" "捌" "钯" "鲅")
    ("bai" "百" "白" "败" "摆" "伯" "拜" "柏" "呗" "掰" "捭" "佰" "稗")
    ("ban" "办" "半" "版" "般" "班" "板" "伴" "搬" "扮" "斑" "颁" "瓣" "拌" "扳" "绊" "阪" "坂" "瘢" "钣" "舨" "癍")
    ("bang" "帮" "邦" "棒" "膀" "榜" "傍" "绑" "磅" "谤" "浜" "梆" "镑" "蚌" "蒡")
    ("bao" "报" "保" "包" "暴" "宝" "抱" "薄" "胞" "爆" "鲍" "饱" "堡" "曝" "刨" "褒" "豹" "雹" "苞" "葆" "褓" "孢" "煲" "鸨" "龅" "趵")
    ("bei" "被" "北" "备" "背" "悲" "辈" "杯" "倍" "贝" "碑" "卑" "蓓" "惫" "悖" "狈" "呗" "焙" "鹎" "孛" "邶" "陂" "埤" "碚" "褙" "鐾" "鞴" "萆" "钡")
    ("ben" "本" "奔" "笨" "苯" "夯" "畚" "贲" "锛" "坌")
    ("beng" "崩" "甭" "绷" "蹦" "迸" "甏" "泵" "嘣" "蚌")
    ("bi" "比" "必" "笔" "毕" "币" "避" "闭" "鼻" "彼" "逼" "壁" "臂" "弊" "碧" "鄙" "毙" "蔽" "庇" "匕" "璧" "敝" "陛" "弼" "篦" "婢" "愎" "痹" "妣" "濞" "铋" "裨" "俾" "髀" "萆" "薜" "哔" "狴" "庳" "秕" "滗" "舭" "毖" "吡" "嬖" "蓖" "贲" "畀" "荸" "埤" "筚" "箅" "芘" "襞" "跸" "荜")
    ("bian" "编" "便" "边" "变" "遍" "辩" "辨" "贬" "鞭" "辫" "扁" "卞" "砭" "苄" "匾" "汴" "蝙" "笾" "碥" "窆" "褊" "弁" "鳊" "忭" "煸" "缏")
    ("biao" "表" "标" "彪" "镖" "膘" "骠" "镳" "裱" "杓" "飙" "瘭" "髟" "飚" "婊" "飑" "鳔")
    ("bie" "别" "憋" "瘪" "蹩" "鳖")
    ("bin" "宾" "滨" "彬" "斌" "鬓" "缤" "殡" "濒" "槟" "摈" "膑" "傧" "玢" "豳" "髌" "镔")
    ("bing" "并" "病" "兵" "冰" "饼" "丙" "柄" "秉" "炳" "禀" "邴" "摒")
    ("bo" "波" "播" "博" "伯" "勃" "薄" "拨" "泊" "柏" "剥" "玻" "驳" "卜" "脖" "搏" "膊" "饽" "簸" "掰" "舶" "跛" "礴" "菠" "帛" "铂" "钵" "渤" "檗" "钹" "擘" "箔" "趵" "孛" "鹁" "踣" "亳" "啵")
    ("bu" "不" "部" "布" "步" "补" "捕" "怖" "卜" "簿" "哺" "埔" "卟" "埠" "钸" "逋" "醭" "晡" "瓿" "钚")
    ("ca" "擦" "嚓" "礤")
    ("cai" "才" "采" "菜" "财" "材" "彩" "裁" "猜" "蔡" "踩" "睬")
    ("can" "参" "餐" "残" "惨" "灿" "惭" "掺" "蚕" "璨" "孱" "骖" "黪" "粲")
    ("cang" "藏" "苍" "仓" "沧" "舱" "伧")
    ("cao" "草" "操" "曹" "糙" "嘈" "槽" "螬" "艚" "漕")
    ("ce" "策" "测" "侧" "厕" "册" "恻")
    ("cen" "参" "岑" "涔")
    ("ceng" "曾" "层" "蹭" "噌")
    ("cha" "查" "察" "差" "茶" "插" "刹" "叉" "诧" "茬" "碴" "喳" "岔" "嚓" "衩" "杈" "楂" "槎" "檫" "镲" "搽" "锸" "猹" "馇" "汊" "姹")
    ("chai" "差" "柴" "拆" "豺" "钗" "侪" "虿" "瘥")
    ("chan" "产" "颤" "缠" "禅" "蝉" "馋" "铲" "搀" "阐" "掺" "潺" "忏" "蟾" "婵" "谄" "谗" "廛" "孱" "澶" "冁" "躔" "蒇" "骣" "觇" "镡" "羼")
    ("chang" "长" "场" "常" "唱" "厂" "尝" "昌" "肠" "偿" "畅" "倡" "倘" "敞" "怅" "娼" "猖" "嫦" "伥" "氅" "徜" "昶" "鲳" "阊" "菖" "苌" "鬯" "惝")
    ("chao" "超" "朝" "潮" "炒" "吵" "抄" "嘲" "钞" "绰" "巢" "晁" "焯" "怊" "耖")
    ("che" "车" "彻" "撤" "扯" "澈" "掣" "坼" "砗")
    ("chen" "称" "陈" "沉" "晨" "尘" "臣" "趁" "衬" "辰" "郴" "谶" "琛" "忱" "嗔" "伧" "抻" "谌" "宸" "榇" "龀" "碜")
    ("cheng" "成" "城" "程" "称" "承" "诚" "盛" "乘" "呈" "撑" "惩" "澄" "秤" "瞠" "橙" "噌" "逞" "铛" "丞" "骋" "埕" "枨" "塍" "铖" "裎" "酲" "柽" "蛏")
    ("chi" "吃" "持" "迟" "尺" "赤" "斥" "池" "痴" "齿" "驰" "耻" "翅" "匙" "侈" "哧" "嗤" "啻" "弛" "蚩" "炽" "笞" "敕" "叱" "饬" "踟" "鸱" "褫" "豉" "坻" "墀" "茌" "篪" "傺" "媸" "螭" "彳" "眵" "魑" "瘛")
    ("chong" "重" "冲" "充" "崇" "虫" "宠" "憧" "忡" "艟" "茺" "舂" "铳")
    ("chou" "抽" "愁" "仇" "丑" "筹" "臭" "酬" "绸" "踌" "瞅" "惆" "畴" "稠" "雠" "俦" "帱" "瘳")
    ("chu" "出" "处" "除" "初" "楚" "触" "储" "础" "厨" "畜" "躇" "橱" "雏" "矗" "怵" "锄" "杵" "搐" "绌" "黜" "褚" "蜍" "蹰" "刍" "滁" "楮" "憷" "亍" "樗")
    ("chuai" "揣" "啜" "踹" "嘬" "膪" "搋")
    ("chuan" "传" "穿" "川" "船" "串" "喘" "舛" "遄" "舡" "巛" "氚" "椽" "钏")
    ("chuang" "创" "窗" "床" "闯" "幢" "疮" "怆")
    ("chui" "吹" "垂" "炊" "锤" "捶" "陲" "槌" "棰")
    ("chun" "春" "纯" "唇" "蠢" "醇" "淳" "椿" "鹑" "蝽" "莼")
    ("chuo" "绰" "戳" "啜" "辍" "踔" "龊")
    ("ci" "此" "次" "词" "差" "刺" "辞" "慈" "磁" "赐" "瓷" "兹" "茨" "雌" "祠" "疵" "呲" "鹚" "糍" "茈")
    ("cong" "从" "匆" "聪" "丛" "葱" "囱" "琮" "淙" "枞" "苁" "骢" "璁")
    ("cou" "凑" "楱" "辏" "腠")
    ("cu" "促" "粗" "簇" "醋" "卒" "猝" "蹴" "蹙" "徂" "殂" "蔟" "酢")
    ("cuan" "攒" "窜" "篡" "蹿" "撺" "镩" "汆" "爨")
    ("cui" "脆" "粹" "催" "摧" "崔" "萃" "翠" "瘁" "悴" "璀" "隹" "淬" "毳" "榱" "啐")
    ("cun" "存" "村" "寸" "忖" "皴")
    ("cuo" "错" "措" "搓" "挫" "撮" "磋" "蹉" "矬" "嵯" "脞" "痤" "瘥" "鹾" "厝" "锉")
    ("da" "大" "打" "达" "答" "搭" "瘩" "嗒" "沓" "耷" "褡" "鞑" "笪" "靼" "怛" "妲" "哒" "疸")
    ("dai" "代" "带" "待" "戴" "袋" "呆" "贷" "逮" "歹" "殆" "黛" "怠" "玳" "岱" "迨" "傣" "呔" "骀" "绐" "埭" "甙")
    ("dan" "但" "单" "担" "弹" "淡" "旦" "蛋" "胆" "诞" "丹" "耽" "惮" "眈" "啖" "澹" "掸" "殚" "箪" "瘅" "赕" "疸" "聃" "氮" "萏" "郸" "儋")
    ("dang" "当" "党" "荡" "档" "挡" "裆" "铛" "宕" "凼" "菪" "谠" "砀")
    ("dao" "到" "道" "导" "倒" "岛" "刀" "悼" "盗" "蹈" "捣" "祷" "叨" "稻" "忉" "帱" "氘" "纛")
    ("de" "的" "得" "德" "锝")
    ("deng" "等" "登" "灯" "邓" "凳" "瞪" "蹬" "噔" "磴" "戥" "镫" "簦" "嶝")
    ("di" "地" "第" "提" "底" "低" "帝" "弟" "敌" "抵" "递" "滴" "迪" "蒂" "堤" "笛" "缔" "涤" "嘀" "诋" "谛" "狄" "邸" "睇" "嫡" "翟" "砥" "娣" "棣" "荻" "羝" "坻" "柢" "觌" "骶" "氐" "绨" "镝" "碲" "籴")
    ("dia" "嗲")
    ("dian" "点" "电" "店" "典" "颠" "甸" "淀" "垫" "殿" "滇" "奠" "惦" "掂" "碘" "癫" "巅" "踮" "佃" "玷" "簟" "阽" "坫" "靛" "钿" "癜" "丶")
    ("diao" "调" "掉" "吊" "雕" "刁" "钓" "凋" "叼" "貂" "碉" "铫" "铞" "鲷")
    ("die" "爹" "跌" "叠" "迭" "碟" "谍" "蝶" "喋" "佚" "踮" "牒" "耋" "蹀" "堞" "瓞" "揲" "垤" "鲽")
    ("ding" "定" "订" "顶" "丁" "盯" "钉" "鼎" "叮" "町" "铤" "腚" "酊" "仃" "锭" "疔" "啶" "玎" "碇" "耵")
    ("diu" "丢" "铥")
    ("dong" "动" "东" "懂" "冬" "洞" "冻" "董" "栋" "咚" "恫" "侗" "氡" "硐" "鸫" "岽" "垌" "峒" "胨" "胴")
    ("dou" "都" "斗" "豆" "抖" "逗" "兜" "陡" "窦" "蔸" "蚪" "篼" "痘")
    ("du" "都" "读" "度" "独" "毒" "督" "渡" "肚" "杜" "睹" "堵" "赌" "妒" "嘟" "渎" "笃" "牍" "镀" "犊" "黩" "髑" "椟" "芏" "蠹")
    ("duan" "断" "段" "短" "端" "锻" "缎" "煅" "椴" "簖")
    ("dui" "对" "队" "堆" "兑" "碓" "憝" "怼" "镦")
    ("dun" "顿" "盾" "吨" "敦" "蹲" "钝" "炖" "遁" "盹" "沌" "囤" "墩" "趸" "镦" "礅" "砘")
    ("duo" "多" "夺" "朵" "躲" "舵" "堕" "踱" "咄" "跺" "哆" "剁" "惰" "垛" "驮" "掇" "铎" "裰" "哚" "缍" "沲" "柁")
    ("e" "额" "俄" "恶" "饿" "哦" "鹅" "扼" "愕" "遏" "噩" "娥" "峨" "呃" "厄" "鄂" "讹" "婀" "蛾" "轭" "颚" "鳄" "锷" "谔" "屙" "锇" "阏" "垩" "腭" "苊" "鹗" "萼" "莪")
    ("ei" "诶")
    ("en" "恩" "摁" "蒽")
    ("er" "而" "二" "儿" "尔" "耳" "迩" "饵" "洱" "鸸" "珥" "铒" "鲕" "贰" "佴")
    ("fa" "发" "法" "罚" "乏" "伐" "阀" "砝" "筏" "垡" "珐")
    ("fan" "反" "饭" "犯" "翻" "范" "凡" "烦" "返" "番" "贩" "繁" "泛" "帆" "藩" "幡" "梵" "樊" "燔" "蕃" "畈" "钒" "蘩" "矾" "蹯")
    ("fang" "方" "放" "房" "访" "防" "仿" "芳" "妨" "纺" "彷" "坊" "肪" "舫" "钫" "鲂" "邡" "枋")
    ("fei" "非" "费" "飞" "废" "肥" "啡" "沸" "菲" "肺" "匪" "诽" "腓" "扉" "吠" "霏" "绯" "妃" "斐" "翡" "蜚" "痱" "淝" "悱" "鲱" "篚" "芾" "狒" "镄" "榧")
    ("fen" "分" "份" "纷" "奋" "愤" "粉" "氛" "芬" "坟" "焚" "粪" "忿" "吩" "汾" "棼" "鼢" "玢" "酚" "偾" "瀵" "鲼")
    ("feng" "风" "封" "丰" "峰" "疯" "锋" "逢" "奉" "缝" "凤" "讽" "冯" "蜂" "枫" "烽" "俸" "砜" "唪" "酆" "葑" "沣")
    ("fo" "佛")
    ("fou" "否" "缶")
    ("fu" "夫" "府" "服" "复" "父" "负" "副" "福" "富" "付" "妇" "附" "佛" "幅" "伏" "符" "赴" "腐" "浮" "扶" "腹" "抚" "覆" "肤" "赋" "弗" "傅" "辅" "拂" "甫" "俯" "斧" "缚" "咐" "脯" "袱" "俘" "敷" "阜" "芙" "釜" "孚" "腑" "匐" "孵" "辐" "涪" "讣" "氟" "桴" "蜉" "芾" "苻" "茯" "莩" "菔" "幞" "怫" "拊" "滏" "黼" "艴" "麸" "绂" "绋" "趺" "祓" "砩" "黻" "罘" "蚨" "跗" "蝠" "呋" "凫" "郛" "稃" "驸" "赙" "馥" "蝮" "鲋" "鳆")
    ("ga" "咖" "尬" "嘎" "噶" "轧" "伽" "旮" "钆" "尕" "尜")
    ("gai" "改" "该" "概" "盖" "丐" "钙" "赅" "溉" "垓" "陔" "戤")
    ("gan" "感" "干" "敢" "赶" "甘" "肝" "杆" "尴" "赣" "橄" "竿" "秆" "擀" "坩" "苷" "柑" "泔" "矸" "澉" "疳" "酐" "淦" "绀" "旰")
    ("gang" "刚" "港" "钢" "岗" "纲" "缸" "扛" "杠" "冈" "肛" "罡" "戆" "筻")
    ("gao" "高" "告" "稿" "搞" "糕" "膏" "皋" "羔" "睾" "槁" "藁" "缟" "篙" "镐" "诰" "槔" "杲" "郜" "锆")
    ("ge" "个" "革" "各" "歌" "格" "哥" "戈" "隔" "葛" "割" "阁" "胳" "搁" "疙" "咯" "鸽" "嗝" "骼" "颌" "屹" "搿" "膈" "镉" "纥" "袼" "仡" "鬲" "塥" "圪" "哿" "舸" "铬" "硌" "虼")
    ("gei" "给")
    ("gen" "根" "跟" "亘" "艮" "哏" "茛")
    ("geng" "更" "耿" "耕" "颈" "庚" "羹" "梗" "哽" "赓" "鲠" "埂" "绠")
    ("gong" "工" "公" "共" "供" "功" "攻" "宫" "贡" "恭" "巩" "躬" "龚" "弓" "拱" "肱" "汞" "蚣" "珙" "觥")
    ("gou" "够" "购" "构" "狗" "沟" "勾" "苟" "钩" "觏" "篝" "垢" "佝" "岣" "诟" "鞲" "笱" "枸" "遘" "媾" "缑" "彀")
    ("gu" "故" "古" "顾" "股" "鼓" "姑" "骨" "固" "孤" "谷" "估" "雇" "辜" "咕" "沽" "箍" "菇" "汩" "轱" "锢" "蛊" "梏" "鸪" "毂" "鹄" "臌" "瞽" "罟" "钴" "觚" "鹘" "菰" "蛄" "嘏" "诂" "崮" "酤" "牿" "牯" "痼" "鲴")
    ("gua" "挂" "瓜" "刮" "寡" "呱" "褂" "卦" "剐" "鸹" "栝" "胍" "诖")
    ("guai" "怪" "乖" "拐" "掴")
    ("guan" "关" "观" "管" "官" "馆" "惯" "冠" "贯" "罐" "灌" "棺" "莞" "倌" "纶" "掼" "盥" "涫" "鳏" "鹳")
    ("guang" "广" "光" "逛" "犷" "咣" "胱" "桄")
    ("gui" "规" "归" "贵" "鬼" "桂" "跪" "柜" "轨" "瑰" "诡" "刽" "龟" "硅" "闺" "皈" "傀" "癸" "圭" "晷" "簋" "妫" "鲑" "匦" "庋" "宄" "炔" "刿" "桧" "炅" "鳜")
    ("gun" "滚" "棍" "鲧" "绲" "磙" "辊" "衮")
    ("guo" "国" "过" "果" "锅" "郭" "裹" "帼" "蝈" "聒" "馘" "掴" "埚" "虢" "呙" "崞" "猓" "椁" "蜾")
    ("ha" "哈" "蛤" "铪")
    ("hai" "还" "海" "孩" "害" "嘿" "咳" "亥" "骇" "骸" "嗨" "胲" "醢" "氦")
    ("han" "汉" "喊" "含" "寒" "汗" "韩" "憾" "涵" "函" "翰" "撼" "罕" "旱" "捍" "酣" "悍" "憨" "晗" "瀚" "鼾" "顸" "阚" "焊" "蚶" "焓" "颔" "菡" "撖" "邗" "邯")
    ("hang" "行" "航" "巷" "杭" "夯" "沆" "颃" "绗" "珩")
    ("hao" "好" "号" "毫" "豪" "浩" "耗" "皓" "嚎" "昊" "郝" "壕" "蒿" "貉" "灏" "镐" "嗥" "嚆" "薅" "濠" "蚝" "颢")
    ("he" "和" "何" "合" "河" "喝" "赫" "核" "吓" "贺" "盒" "呵" "禾" "荷" "鹤" "壑" "阂" "褐" "诃" "涸" "阖" "嗬" "貉" "曷" "颌" "劾" "盍" "纥" "蚵" "翮" "菏")
    ("hei" "黑" "嘿" "嗨")
    ("hen" "很" "恨" "狠" "痕")
    ("heng" "横" "衡" "恒" "哼" "亨" "蘅" "珩" "桁")
    ("hong" "红" "轰" "洪" "鸿" "哄" "宏" "虹" "弘" "烘" "泓" "闳" "薨" "讧" "蕻" "訇" "黉" "荭")
    ("hou" "后" "候" "後" "厚" "侯" "喉" "吼" "猴" "逅" "糇" "骺" "堠" "瘊" "篌" "鲎")
    ("hu" "乎" "护" "呼" "胡" "户" "湖" "忽" "互" "糊" "虎" "壶" "狐" "沪" "惚" "浒" "唬" "葫" "弧" "蝴" "囫" "瑚" "斛" "祜" "猢" "鹄" "醐" "戽" "扈" "唿" "笏" "琥" "滹" "鹕" "轷" "烀" "冱" "岵" "怙" "鹘" "槲" "觳" "瓠" "鹱" "煳")
    ("hua" "话" "华" "化" "花" "划" "画" "滑" "哗" "桦" "猾" "砉" "铧" "骅")
    ("huai" "怀" "坏" "徊" "淮" "槐" "踝")
    ("huan" "欢" "换" "还" "环" "缓" "患" "幻" "唤" "宦" "焕" "痪" "寰" "鬟" "涣" "浣" "奂" "桓" "缳" "豢" "锾" "郇" "萑" "圜" "洹" "擐" "獾" "漶" "逭" "鲩")
    ("huang" "黄" "皇" "荒" "晃" "慌" "煌" "惶" "恍" "谎" "璜" "徨" "簧" "凰" "幌" "潢" "蝗" "蟥" "遑" "隍" "肓" "磺" "癀" "湟" "篁" "鳇")
    ("hui" "会" "回" "汇" "挥" "辉" "灰" "惠" "毁" "悔" "恢" "慧" "绘" "徽" "讳" "贿" "徊" "晦" "秽" "诲" "诙" "晖" "彗" "麾" "烩" "荟" "卉" "茴" "喙" "蛔" "恚" "洄" "珲" "蕙" "哕" "咴" "浍" "虺" "缋" "桧" "隳" "蟪")
    ("hun" "婚" "混" "魂" "昏" "浑" "馄" "荤" "诨" "溷" "阍" "珲")
    ("huo" "和" "或" "活" "火" "获" "货" "伙" "祸" "惑" "霍" "豁" "夥" "锪" "耠" "劐" "钬" "攉" "藿" "嚯" "镬" "蠖")
    ("ji" "几" "给" "己" "机" "记" "及" "计" "即" "基" "济" "辑" "级" "极" "寄" "际" "技" "集" "纪" "击" "奇" "急" "激" "继" "既" "积" "籍" "鸡" "吉" "挤" "迹" "季" "寂" "绩" "疾" "饥" "祭" "缉" "忌" "剂" "圾" "姬" "矶" "肌" "嫉" "讥" "藉" "叽" "脊" "冀" "稽" "妓" "棘" "骥" "畸" "蓟" "汲" "悸" "岌" "伎" "笈" "跻" "瘠" "亟" "诘" "暨" "霁" "羁" "稷" "偈" "戟" "嵇" "楫" "唧" "鲫" "髻" "荠" "箕" "觊" "蒺" "畿" "虮" "齑" "殛" "墼" "佶" "掎" "芨" "丌" "麂" "蕺" "咭" "嵴" "芰" "笄" "哜" "洎" "乩" "戢" "屐" "剞" "跽" "玑" "鲚" "赍" "犄")
    ("jia" "家" "加" "价" "假" "架" "甲" "佳" "驾" "夹" "嫁" "嘉" "贾" "稼" "茄" "佼" "挟" "颊" "皎" "侥" "枷" "珈" "戛" "迦" "伽" "浃" "痂" "胛" "笳" "荚" "葭" "钾" "镓" "嘏" "郏" "挢" "岬" "徼" "湫" "敫" "袈" "瘕" "恝" "铗" "袷" "蛱" "跏")
    ("jian" "见" "间" "件" "建" "简" "坚" "监" "减" "渐" "检" "健" "兼" "剑" "艰" "肩" "键" "荐" "尖" "鉴" "剪" "践" "奸" "捡" "箭" "舰" "拣" "贱" "溅" "煎" "俭" "槛" "碱" "歼" "缄" "茧" "笺" "柬" "谏" "蹇" "僭" "涧" "菅" "謇" "硷" "睑" "锏" "饯" "毽" "鲣" "鞯" "蒹" "搛" "谫" "囝" "湔" "缣" "枧" "戬" "戋" "犍" "裥" "笕" "翦" "趼" "楗" "牮" "鹣" "腱" "踺")
    ("jiang" "将" "讲" "强" "江" "奖" "降" "蒋" "疆" "酱" "姜" "浆" "僵" "匠" "犟" "缰" "绛" "桨" "耩" "礓" "洚" "豇" "茳" "糨")
    ("jiao" "教" "交" "觉" "校" "叫" "较" "角" "脚" "焦" "骄" "郊" "轿" "搅" "嚼" "胶" "缴" "绞" "饺" "椒" "矫" "娇" "佼" "狡" "浇" "跤" "姣" "窖" "剿" "侥" "皎" "蕉" "酵" "礁" "鲛" "徼" "湫" "敫" "僬" "鹪" "峤" "蛟" "铰" "艽" "茭" "挢" "噍" "醮")
    ("jie" "界" "解" "接" "结" "节" "街" "姐" "阶" "介" "借" "戒" "杰" "届" "皆" "捷" "截" "洁" "揭" "劫" "竭" "藉" "睫" "诫" "嗟" "拮" "孑" "碣" "秸" "诘" "桀" "芥" "偈" "颉" "讦" "疖" "疥" "婕" "羯" "鲒" "蚧" "骱" "喈")
    ("jin" "进" "今" "金" "近" "尽" "仅" "紧" "禁" "劲" "津" "斤" "谨" "锦" "筋" "晋" "巾" "浸" "襟" "瑾" "矜" "靳" "缙" "烬" "噤" "觐" "馑" "堇" "衿" "荩" "廑" "妗" "卺" "赆" "槿")
    ("jing" "经" "京" "精" "境" "警" "竟" "静" "惊" "景" "敬" "睛" "镜" "竞" "净" "井" "径" "晶" "荆" "兢" "颈" "憬" "靖" "鲸" "泾" "阱" "儆" "旌" "痉" "迳" "茎" "胫" "腈" "菁" "粳" "獍" "肼" "弪" "婧" "刭" "靓")
    ("jiong" "窘" "炯" "迥" "扃" "炅")
    ("jiu" "就" "九" "究" "酒" "久" "旧" "救" "纠" "揪" "疚" "舅" "韭" "赳" "鸠" "灸" "咎" "啾" "臼" "鹫" "阄" "僦" "厩" "玖" "柩" "桕" "鬏")
    ("ju" "局" "据" "居" "句" "举" "具" "剧" "巨" "聚" "拒" "俱" "距" "惧" "菊" "拘" "矩" "桔" "驹" "鞠" "咀" "沮" "瞿" "锯" "炬" "飓" "趄" "掬" "踽" "踞" "遽" "橘" "倨" "疽" "龃" "屦" "犋" "裾" "钜" "苴" "雎" "鞫" "椐" "讵" "苣" "锔" "狙" "榘" "莒" "枸" "榉" "窭" "醵" "琚")
    ("juan" "捐" "卷" "倦" "眷" "娟" "隽" "绢" "鹃" "涓" "镌" "锩" "鄄" "狷" "桊" "蠲")
    ("jue" "觉" "绝" "决" "脚" "嚼" "掘" "诀" "崛" "爵" "抉" "倔" "獗" "嗟" "厥" "蹶" "攫" "谲" "矍" "撅" "噱" "孓" "橛" "噘" "珏" "桷" "劂" "爝" "镢" "蕨" "觖")
    ("jun" "军" "均" "君" "俊" "峻" "钧" "隽" "筠" "菌" "郡" "骏" "竣" "麇" "皲" "捃" "浚")
    ("ka" "卡" "咖" "喀" "咔" "佧" "胩")
    ("kai" "开" "慨" "凯" "铠" "揩" "楷" "恺" "垲" "蒈" "锎" "剀" "锴" "忾")
    ("kan" "看" "刊" "侃" "堪" "砍" "坎" "槛" "勘" "瞰" "龛" "阚" "莰" "戡")
    ("kang" "抗" "康" "慷" "扛" "炕" "亢" "糠" "伉" "闶" "钪")
    ("kao" "考" "靠" "铐" "烤" "拷" "犒" "栲" "尻")
    ("ke" "可" "克" "科" "客" "刻" "课" "颗" "渴" "柯" "呵" "棵" "恪" "咳" "苛" "磕" "壳" "坷" "嗑" "瞌" "轲" "稞" "疴" "蝌" "溘" "髁" "钶" "窠" "颏" "珂" "岢" "骒" "缂" "氪" "锞" "蚵")
    ("ken" "肯" "恳" "啃" "垦" "龈" "裉")
    ("keng" "坑" "吭" "铿")
    ("kong" "空" "恐" "控" "孔" "倥" "崆" "箜")
    ("kou" "口" "扣" "抠" "寇" "叩" "蔻" "眍" "芤" "筘")
    ("ku" "苦" "哭" "库" "裤" "酷" "枯" "窟" "骷" "刳" "堀" "喾" "绔")
    ("kua" "夸" "跨" "垮" "挎" "胯" "侉")
    ("kuai" "会" "快" "块" "筷" "脍" "蒯" "哙" "侩" "狯" "浍" "郐")
    ("kuan" "款" "宽" "髋")
    ("kuang" "况" "狂" "矿" "框" "旷" "眶" "筐" "匡" "哐" "邝" "诓" "夼" "诳" "圹" "纩" "贶")
    ("kui" "亏" "愧" "溃" "窥" "魁" "馈" "睽" "盔" "逵" "葵" "奎" "匮" "傀" "喟" "聩" "岿" "馗" "夔" "篑" "喹" "悝" "暌" "隗" "蒉" "蝰" "愦" "揆" "跬")
    ("kun" "困" "昆" "捆" "坤" "鲲" "悃" "髡" "锟" "醌" "阃" "琨")
    ("kuo" "括" "阔" "扩" "廓" "栝" "蛞")
    ("la" "拉" "啦" "辣" "腊" "喇" "垃" "蜡" "剌" "邋" "旯" "瘌" "砬")
    ("lai" "来" "赖" "莱" "睐" "癞" "籁" "徕" "涞" "赉" "铼" "崃" "濑")
    ("lan" "兰" "蓝" "栏" "烂" "懒" "览" "滥" "拦" "篮" "揽" "澜" "榄" "婪" "缆" "斓" "岚" "阑" "褴" "镧" "罱" "谰" "漤")
    ("lang" "浪" "狼" "朗" "郎" "廊" "琅" "螂" "榔" "啷" "莨" "锒" "稂" "阆" "蒗")
    ("lao" "老" "劳" "牢" "捞" "姥" "佬" "潦" "唠" "烙" "酪" "涝" "崂" "痨" "醪" "铹" "栳" "铑" "耢")
    ("le" "了" "乐" "勒" "肋" "叻" "泐" "鳓" "仂")
    ("lei" "类" "泪" "累" "雷" "蕾" "垒" "磊" "擂" "肋" "儡" "羸" "诔" "镭" "嘞" "檑" "嫘" "缧" "酹" "耒")
    ("leng" "冷" "愣" "楞" "棱" "塄")
    ("li" "里" "理" "力" "利" "立" "李" "历" "离" "例" "礼" "丽" "励" "黎" "厉" "璃" "莉" "哩" "笠" "粒" "俐" "漓" "栗" "狸" "梨" "隶" "吏" "沥" "篱" "厘" "犁" "雳" "罹" "莅" "戾" "鲤" "俚" "砺" "藜" "俪" "蜊" "黧" "郦" "痢" "枥" "逦" "娌" "詈" "骊" "荔" "鳢" "喱" "鹂" "嫠" "蠡" "鬲" "鲡" "悝" "坜" "苈" "砾" "藓" "呖" "唳" "猁" "溧" "澧" "栎" "轹" "蓠" "傈" "缡" "疠" "疬" "蛎" "锂" "篥" "粝" "跞" "醴")
    ("lia" "俩")
    ("lian" "联" "连" "脸" "练" "恋" "怜" "莲" "廉" "炼" "帘" "链" "敛" "涟" "镰" "殓" "琏" "楝" "裢" "裣" "蠊" "鲢" "濂" "臁" "潋" "蔹" "奁")
    ("liang" "两" "量" "良" "亮" "辆" "梁" "俩" "凉" "粮" "谅" "粱" "晾" "踉" "莨" "墚" "魉" "椋" "靓")
    ("liao" "了" "料" "聊" "疗" "辽" "僚" "廖" "寥" "镣" "潦" "撩" "撂" "缭" "燎" "寮" "嘹" "钌" "獠" "鹩" "蓼" "尥")
    ("lie" "列" "烈" "裂" "劣" "猎" "咧" "趔" "冽" "洌" "捩" "埒" "躐" "鬣")
    ("lin" "林" "临" "邻" "琳" "淋" "霖" "麟" "凛" "吝" "鳞" "磷" "躏" "赁" "嶙" "辚" "檩" "遴" "粼" "蔺" "懔" "瞵" "啉" "膦" "廪")
    ("ling" "领" "令" "另" "灵" "零" "龄" "凌" "玲" "铃" "陵" "岭" "拎" "伶" "聆" "囹" "棱" "菱" "翎" "苓" "瓴" "棂" "绫" "呤" "柃" "鲮" "酃" "泠" "羚" "蛉")
    ("liu" "六" "留" "流" "陆" "刘" "溜" "柳" "碌" "瘤" "榴" "浏" "硫" "琉" "遛" "馏" "镏" "骝" "绺" "锍" "旒" "熘" "鎏" "鹨")
    ("long" "龙" "隆" "笼" "胧" "拢" "咙" "聋" "垄" "珑" "窿" "陇" "癃" "茏" "栊" "泷" "垅" "砻")
    ("lou" "楼" "陋" "漏" "搂" "喽" "篓" "偻" "娄" "髅" "蝼" "镂" "蒌" "嵝" "耧" "瘘")
    ("lu" "路" "陆" "录" "卢" "露" "鲁" "炉" "鹿" "碌" "庐" "芦" "噜" "颅" "禄" "辘" "卤" "虏" "麓" "泸" "赂" "漉" "戮" "簏" "轳" "鹭" "掳" "潞" "鲈" "撸" "栌" "垆" "胪" "蓼" "渌" "鸬" "逯" "璐" "辂" "橹" "镥" "舻" "氇")
    ("lv" "律" "旅" "绿" "率" "虑" "履" "屡" "侣" "缕" "驴" "吕" "榈" "滤" "捋" "铝" "褛" "闾" "膂" "氯" "稆")
    ("luan" "乱" "卵" "峦" "挛" "孪" "栾" "銮" "娈" "滦" "鸾" "脔")
    ("lue" "略" "掠" "锊")
    ("lun" "论" "轮" "伦" "沦" "仑" "抡" "囵" "纶")
    ("luo" "落" "罗" "络" "洛" "逻" "裸" "骆" "萝" "螺" "锣" "箩" "摞" "烙" "捋" "珞" "骡" "猡" "镙" "椤" "倮" "蠃" "荦" "瘰" "泺" "漯" "脶" "硌" "雒")
    ("m" "呒")
    ("ma" "马" "吗" "妈" "码" "麻" "骂" "嘛" "抹" "玛" "蚂" "蟆" "唛" "杩" "犸" "嬷")
    ("mai" "买" "卖" "麦" "埋" "迈" "脉" "霾" "劢" "荬")
    ("man" "满" "慢" "漫" "曼" "蛮" "馒" "瞒" "蔓" "颟" "谩" "墁" "幔" "螨" "鞔" "鳗" "缦" "熳" "镘")
    ("mang" "忙" "茫" "盲" "芒" "氓" "莽" "蟒" "邙" "漭" "硭")
    ("mao" "毛" "冒" "猫" "贸" "矛" "帽" "貌" "茅" "茂" "髦" "卯" "耄" "瑁" "锚" "懋" "袤" "铆" "峁" "牦" "蟊" "泖" "昴" "茆" "旄" "蝥" "瞀")
    ("me" "么" "麽")
    ("mei" "没" "美" "每" "妹" "眉" "梅" "媒" "枚" "魅" "煤" "昧" "霉" "玫" "媚" "寐" "糜" "袂" "酶" "莓" "嵋" "楣" "湄" "猸" "镅" "浼" "鹛" "镁")
    ("men" "们" "门" "闷" "扪" "懑" "焖" "钔")
    ("meng" "梦" "蒙" "猛" "盟" "朦" "孟" "萌" "勐" "懵" "檬" "蠓" "瞢" "甍" "礞" "蜢" "虻" "艋" "艨" "锰")
    ("mi" "密" "米" "秘" "迷" "弥" "谜" "觅" "眯" "蜜" "靡" "咪" "谧" "泌" "糜" "汨" "宓" "麋" "醚" "弭" "敉" "芈" "祢" "脒" "幂" "縻" "嘧" "蘼" "猕" "糸")
    ("mian" "面" "免" "棉" "眠" "缅" "绵" "勉" "腼" "冕" "娩" "湎" "沔" "眄" "黾" "渑")
    ("miao" "妙" "描" "秒" "庙" "苗" "渺" "瞄" "藐" "缪" "淼" "缈" "喵" "眇" "邈" "鹋" "杪")
    ("mie" "灭" "蔑" "篾" "咩" "乜" "蠛")
    ("min" "民" "敏" "悯" "闽" "泯" "珉" "皿" "抿" "闵" "苠" "岷" "缗" "玟" "愍" "黾" "鳘")
    ("ming" "名" "明" "命" "鸣" "铭" "冥" "茗" "溟" "酩" "瞑" "暝" "螟")
    ("miu" "谬" "缪")
    ("mo" "默" "莫" "模" "麽" "末" "磨" "摸" "摩" "寞" "漠" "墨" "抹" "魔" "陌" "嘿" "沫" "膜" "蓦" "蘑" "茉" "馍" "摹" "貉" "谟" "嫫" "秣" "镆" "殁" "瘼" "耱" "貊" "貘")
    ("mou" "某" "谋" "眸" "缪" "鍪" "哞" "侔" "蛑")
    ("mu" "目" "母" "木" "幕" "姆" "慕" "牧" "墓" "募" "暮" "牟" "亩" "穆" "睦" "拇" "沐" "牡" "仫" "坶" "苜" "毪" "钼")
    ("n" "嗯" "唔")
    ("na" "那" "拿" "呢" "哪" "纳" "娜" "呐" "捺" "钠" "镎" "肭" "衲")
    ("nai" "乃" "奶" "奈" "耐" "氖" "艿" "鼐" "佴" "萘" "柰")
    ("nan" "难" "南" "男" "楠" "喃" "囡" "囝" "腩" "蝻" "赧")
    ("nang" "囊" "囔" "馕" "攮" "曩")
    ("nao" "脑" "闹" "恼" "挠" "瑙" "淖" "呶" "猱" "铙" "孬" "硇" "蛲" "垴")
    ("ne" "呢" "讷")
    ("nei" "内" "馁")
    ("nen" "嫩" "恁")
    ("neng" "能")
    ("ng" "嗯" "唔")
    ("ni" "你" "呢" "尼" "泥" "逆" "倪" "匿" "拟" "腻" "妮" "霓" "昵" "溺" "旎" "睨" "鲵" "坭" "猊" "怩" "伲" "祢" "慝" "铌")
    ("nian" "年" "念" "廿" "粘" "碾" "捻" "蔫" "撵" "拈" "黏" "鲶" "鲇" "辇" "埝")
    ("niang" "娘" "酿")
    ("niao" "鸟" "尿" "袅" "嬲" "茑" "脲")
    ("nie" "捏" "涅" "聂" "孽" "蹑" "嗫" "啮" "镊" "镍" "乜" "陧" "颞" "臬" "蘖")
    ("nin" "您" "恁")
    ("ning" "宁" "凝" "拧" "泞" "咛" "狞" "柠" "佞" "聍" "苎" "甯")
    ("niu" "牛" "纽" "扭" "妞" "钮" "拗" "忸" "狃")
    ("nong" "农" "弄" "浓" "侬" "哝" "脓")
    ("nou" "耨")
    ("nu" "怒" "努" "奴" "弩" "驽" "胬" "孥")
    ("nv" "女" "钕" "恧" "衄")
    ("nuan" "暖")
    ("nue" "虐" "疟")
    ("nuo" "诺" "挪" "懦" "糯" "喏" "搦" "傩" "锘")
    ("o" "哦" "噢" "喔")
    ("ou" "欧" "偶" "殴" "呕" "鸥" "讴" "瓯" "藕" "沤" "耦" "怄")
    ("pa" "怕" "爬" "帕" "扒" "趴" "啪" "琶" "葩" "耙" "杷" "钯" "筢")
    ("pai" "派" "排" "牌" "拍" "徘" "湃" "俳" "蒎" "哌")
    ("pan" "判" "盘" "盼" "叛" "畔" "潘" "攀" "拚" "蹒" "磐" "爿" "蟠" "襻" "袢" "泮")
    ("pang" "旁" "庞" "胖" "乓" "膀" "磅" "彷" "螃" "滂" "耪" "逄")
    ("pao" "跑" "炮" "抛" "泡" "袍" "刨" "咆" "狍" "疱" "脬" "庖" "匏")
    ("pei" "配" "陪" "培" "佩" "赔" "沛" "裴" "呸" "胚" "醅" "锫" "辔" "帔" "旆" "霈")
    ("pen" "盆" "喷" "湓")
    ("peng" "朋" "鹏" "碰" "彭" "捧" "棚" "蓬" "膨" "烹" "抨" "篷" "砰" "澎" "怦" "堋" "蟛" "嘭" "硼")
    ("pi" "批" "否" "皮" "屁" "披" "疲" "辟" "啤" "脾" "匹" "僻" "劈" "譬" "坯" "痞" "癖" "琵" "毗" "霹" "噼" "媲" "郫" "裨" "纰" "丕" "鼙" "圮" "蚍" "蜱" "貔" "陂" "陴" "砒" "仳" "埤" "擗" "吡" "庀" "邳" "疋" "芘" "枇" "罴" "淠" "铍" "甓" "睥")
    ("pian" "便" "片" "篇" "偏" "骗" "翩" "扁" "犏" "谝" "蹁" "骈" "缏" "胼")
    ("piao" "票" "漂" "飘" "瓢" "嫖" "瞟" "骠" "嘌" "剽" "螵" "缥" "莩" "殍")
    ("pie" "撇" "瞥" "氕" "丿" "苤")
    ("pin" "品" "贫" "拼" "频" "聘" "拚" "姘" "嫔" "榀" "颦" "牝")
    ("ping" "平" "评" "瓶" "凭" "萍" "乒" "屏" "苹" "坪" "枰" "娉" "俜" "鲆")
    ("po" "破" "迫" "颇" "婆" "坡" "泊" "泼" "魄" "粕" "珀" "叵" "攴" "钷" "笸" "钋" "陂" "泺" "鄱" "皤")
    ("pou" "剖" "裒" "掊")
    ("pu" "普" "铺" "扑" "朴" "谱" "浦" "葡" "蒲" "仆" "脯" "瀑" "菩" "溥" "匍" "璞" "噗" "圃" "埔" "氆" "镨" "蹼" "镤" "濮" "莆")
    ("qi" "起" "其" "期" "气" "七" "奇" "妻" "企" "器" "汽" "棋" "齐" "旗" "弃" "启" "骑" "欺" "歧" "岂" "戚" "凄" "泣" "契" "琪" "乞" "祈" "漆" "迄" "脐" "栖" "沏" "祺" "崎" "祁" "琦" "蹊" "砌" "憩" "淇" "汔" "亟" "绮" "讫" "嘁" "岐" "萋" "俟" "杞" "芪" "荠" "耆" "槭" "颀" "芑" "屺" "欹" "桤" "綮" "萁" "蛴" "蜞" "綦" "鳍" "麒" "蕲" "柒" "亓" "骐" "葺" "畦" "圻" "碛")
    ("qia" "恰" "洽" "掐" "伽" "袷" "葜" "髂")
    ("qian" "前" "钱" "千" "签" "欠" "牵" "浅" "潜" "迁" "谦" "遣" "歉" "纤" "嵌" "乾" "谴" "铅" "虔" "钳" "骞" "倩" "堑" "黔" "掮" "悭" "芊" "缱" "愆" "荨" "芡" "阡" "佥" "搴" "褰" "肷" "钎" "仟" "犍" "钤" "岍" "箝" "鬈" "扦" "慊" "椠")
    ("qiang" "枪" "墙" "抢" "腔" "呛" "锵" "跄" "羌" "蔷" "戕" "襁" "樯" "炝" "蜣" "嫱" "锖" "戗" "羟" "镪")
    ("qiao" "桥" "悄" "乔" "巧" "侨" "瞧" "敲" "翘" "俏" "窍" "峭" "锹" "撬" "跷" "憔" "樵" "鞘" "橇" "诮" "愀" "谯" "荞" "峤" "缲" "硗" "鞒" "劁")
    ("qie" "切" "且" "窃" "怯" "茄" "趄" "妾" "砌" "惬" "伽" "锲" "挈" "郄" "箧" "慊")
    ("qin" "亲" "钦" "琴" "侵" "秦" "勤" "芹" "擒" "寝" "覃" "沁" "禽" "噙" "揿" "檎" "锓" "芩" "嗪" "螓" "衾" "廑" "溱" "吣")
    ("qing" "情" "请" "青" "清" "轻" "晴" "庆" "倾" "卿" "擎" "顷" "氢" "罄" "蜻" "磬" "謦" "苘" "圊" "檠" "黥" "鲭" "氰" "箐" "綮")
    ("qiong" "穷" "琼" "穹" "茕" "邛" "蛩" "筇" "跫" "銎")
    ("qiu" "求" "球" "秋" "邱" "囚" "丘" "酋" "蚯" "裘" "俅" "虬" "鳅" "逑" "遒" "赇" "泅" "楸" "犰" "湫" "蝤" "巯" "鼽" "糗")
    ("qu" "去" "取" "区" "曲" "趣" "屈" "趋" "驱" "渠" "躯" "娶" "觑" "瞿" "岖" "戌" "蛐" "衢" "蛆" "癯" "麴" "阒" "祛" "磲" "鸲" "诎" "蠼" "劬" "蕖" "蘧" "龋" "苣" "黢" "璩" "氍" "朐")
    ("quan" "全" "权" "圈" "劝" "泉" "券" "拳" "犬" "诠" "颧" "蜷" "绻" "荃" "铨" "痊" "鬈" "辁" "悛" "畎" "醛" "筌")
    ("que" "却" "确" "缺" "雀" "瘸" "榷" "鹊" "阕" "阙" "炔" "悫")
    ("qun" "群" "裙" "逡" "麇")
    ("ran" "然" "染" "燃" "冉" "髯" "苒" "蚺")
    ("rang" "让" "嚷" "攘" "壤" "瓤" "穰" "禳")
    ("rao" "扰" "绕" "饶" "娆" "桡" "荛")
    ("re" "热" "惹" "喏")
    ("ren" "人" "任" "认" "忍" "仁" "韧" "刃" "纫" "饪" "壬" "仞" "稔" "葚" "荏" "妊" "轫" "衽")
    ("reng" "仍" "扔")
    ("ri" "日")
    ("rong" "容" "荣" "融" "蓉" "溶" "绒" "熔" "榕" "戎" "嵘" "茸" "冗" "肜" "蝾" "狨")
    ("rou" "肉" "柔" "揉" "蹂" "鞣" "糅")
    ("ru" "如" "入" "辱" "儒" "乳" "汝" "褥" "嚅" "茹" "濡" "蠕" "孺" "缛" "襦" "颥" "薷" "蓐" "洳" "溽" "铷")
    ("ruan" "软" "阮" "朊")
    ("rui" "瑞" "锐" "芮" "睿" "蕤" "枘" "蕊" "蚋")
    ("run" "润" "闰")
    ("ruo" "若" "弱" "偌" "箬")
    ("sa" "洒" "撒" "萨" "卅" "仨" "飒" "挲" "脎")
    ("sai" "赛" "塞" "腮" "噻" "鳃")
    ("san" "三" "散" "伞" "叁" "毵" "馓" "糁" "霰")
    ("sang" "丧" "桑" "嗓" "搡" "磉" "颡")
    ("sao" "扫" "骚" "嫂" "梢" "臊" "搔" "缲" "缫" "鳋" "埽" "瘙")
    ("se" "色" "塞" "涩" "瑟" "啬" "铯" "穑")
    ("sen" "森")
    ("seng" "僧")
    ("sha" "杀" "沙" "啥" "傻" "厦" "刹" "纱" "莎" "煞" "砂" "霎" "嗄" "挲" "歃" "鲨" "唼" "痧" "裟" "铩")
    ("shai" "晒" "筛" "酾")
    ("shan" "山" "善" "闪" "衫" "删" "煽" "扇" "陕" "珊" "杉" "擅" "掺" "膳" "栅" "讪" "跚" "汕" "姗" "赡" "潸" "缮" "嬗" "掸" "膻" "骟" "芟" "埏" "剡" "钐" "鄯" "舢" "苫" "髟" "疝" "蟮" "鳝")
    ("shang" "上" "商" "伤" "尚" "赏" "殇" "裳" "晌" "觞" "熵" "墒" "绱" "垧")
    ("shao" "少" "绍" "烧" "稍" "勺" "哨" "邵" "梢" "捎" "韶" "苕" "鞘" "潲" "劭" "杓" "芍" "蛸" "筲" "艄")
    ("she" "社" "设" "舍" "涉" "射" "摄" "舌" "蛇" "奢" "赦" "慑" "佘" "赊" "麝" "畲" "厍" "滠" "歙" "猞")
    ("shei" "谁")
    ("shen" "什" "身" "深" "神" "参" "甚" "申" "审" "沈" "伸" "慎" "渗" "绅" "肾" "呻" "婶" "莘" "蜃" "葚" "娠" "渖" "矧" "诜" "砷" "糁" "谂" "椹" "胂" "哂")
    ("sheng" "生" "声" "省" "胜" "升" "圣" "盛" "剩" "牲" "绳" "甥" "笙" "渑" "眚" "嵊" "晟")
    ("shi" "是" "时" "十" "事" "实" "使" "世" "市" "识" "始" "士" "师" "诗" "式" "失" "史" "视" "示" "食" "室" "势" "试" "石" "释" "施" "适" "氏" "驶" "饰" "尸" "拾" "逝" "湿" "誓" "狮" "嗜" "蚀" "嘘" "屎" "侍" "匙" "峙" "仕" "恃" "柿" "轼" "矢" "噬" "拭" "虱" "弑" "蓍" "埘" "莳" "炻" "谥" "鲥" "豕" "贳" "铈" "螫" "舐" "筮" "鲺" "酾")
    ("shou" "手" "受" "收" "首" "授" "守" "售" "瘦" "寿" "兽" "狩" "绶" "艏")
    ("shu" "书" "数" "术" "属" "输" "树" "述" "熟" "束" "署" "殊" "舒" "叔" "鼠" "疏" "淑" "抒" "薯" "梳" "暑" "竖" "蜀" "恕" "墅" "孰" "漱" "枢" "俞" "赎" "黍" "蔬" "曙" "倏" "庶" "戍" "塾" "澍" "姝" "纾" "秫" "毹" "殳" "疋" "菽" "丨" "沭" "摅" "腧")
    ("shua" "刷" "耍" "唰")
    ("shuai" "率" "衰" "摔" "甩" "帅" "蟀")
    ("shuan" "涮" "栓" "拴" "闩")
    ("shuang" "双" "爽" "霜" "孀" "泷")
    ("shui" "水" "谁" "税" "睡")
    ("shun" "顺" "舜" "瞬" "吮")
    ("shuo" "说" "朔" "硕" "烁" "铄" "妁" "蒴" "槊" "搠")
    ("si" "四" "死" "思" "斯" "司" "似" "私" "丝" "寺" "撕" "肆" "厮" "嘶" "伺" "饲" "嗣" "祀" "巳" "驷" "鸶" "俟" "汜" "泗" "厶" "兕" "蛳" "咝" "姒" "澌" "缌" "耜" "笥" "锶")
    ("song" "送" "松" "宋" "诵" "耸" "颂" "讼" "悚" "怂" "忪" "淞" "菘" "崧" "嵩" "凇" "竦")
    ("sou" "搜" "艘" "嗽" "擞" "馊" "薮" "嗾" "叟" "嗖" "溲" "飕" "锼" "瞍" "螋")
    ("su" "苏" "诉" "速" "素" "俗" "肃" "宿" "塑" "稣" "溯" "酥" "粟" "簌" "夙" "嗉" "谡" "僳" "愫" "涑" "蔌" "觫")
    ("suan" "算" "酸" "蒜" "狻")
    ("sui" "岁" "随" "虽" "碎" "遂" "祟" "隧" "髓" "邃" "穗" "隋" "绥" "睢" "荽" "燧" "谇" "眭" "濉")
    ("sun" "孙" "损" "笋" "荪" "狲" "飧" "榫" "隼")
    ("suo" "所" "索" "缩" "锁" "琐" "梭" "嗦" "唆" "挲" "娑" "睃" "唢" "嗍" "蓑" "羧" "桫")
    ("ta" "他" "她" "它" "踏" "塔" "塌" "榻" "嗒" "蹋" "沓" "遢" "挞" "鳎" "闼" "铊" "趿" "漯" "溻" "獭")
    ("tai" "太" "台" "态" "泰" "抬" "胎" "汰" "苔" "呔" "鲐" "邰" "薹" "酞" "骀" "炱" "跆" "肽" "钛")
    ("tan" "谈" "探" "弹" "坦" "叹" "坛" "摊" "贪" "滩" "毯" "谭" "潭" "瘫" "炭" "覃" "痰" "忐" "坍" "袒" "碳" "澹" "檀" "昙" "镡" "郯" "锬" "钽")
    ("tang" "堂" "唐" "汤" "躺" "糖" "趟" "倘" "烫" "淌" "膛" "塘" "棠" "搪" "溏" "螳" "瑭" "樘" "螗" "铴" "醣" "镗" "耥" "饧" "傥" "帑" "羰")
    ("tao" "讨" "套" "逃" "涛" "掏" "陶" "桃" "淘" "滔" "萄" "焘" "啕" "韬" "饕" "洮" "绦" "鼗")
    ("te" "特" "忑" "忒" "慝" "铽")
    ("tei" "忒")
    ("teng" "腾" "疼" "藤" "誊" "滕")
    ("ti" "体" "提" "题" "替" "踢" "梯" "啼" "涕" "蹄" "剔" "剃" "惕" "屉" "嚏" "悌" "醍" "缇" "鹈" "锑" "荑" "倜" "绨" "逖" "裼")
    ("tian" "天" "田" "填" "甜" "添" "腆" "舔" "恬" "钿" "阗" "畋" "忝" "殄" "掭")
    ("tiao" "条" "调" "跳" "挑" "迢" "眺" "鲦" "佻" "苕" "窕" "髫" "粜" "笤" "龆" "祧" "蜩")
    ("tie" "铁" "贴" "帖" "餮" "萜")
    ("ting" "听" "停" "庭" "厅" "挺" "亭" "婷" "廷" "艇" "町" "霆" "汀" "铤" "蜓" "莛" "梃" "葶" "烃")
    ("tong" "同" "通" "统" "痛" "童" "彤" "筒" "铜" "桶" "捅" "桐" "瞳" "佟" "恸" "酮" "恫" "侗" "砼" "嗵" "仝" "垌" "茼" "峒" "潼")
    ("tou" "头" "投" "偷" "透" "钭" "骰")
    ("tu" "土" "突" "图" "途" "徒" "屠" "涂" "吐" "兔" "秃" "凸" "荼" "酴" "钍" "菟" "堍")
    ("tuan" "团" "湍" "抟" "疃" "彖")
    ("tui" "推" "退" "腿" "褪" "颓" "蜕" "忒" "煺")
    ("tun" "吞" "屯" "饨" "褪" "臀" "囤" "豚" "暾" "氽")
    ("tuo" "托" "脱" "拖" "妥" "拓" "陀" "驼" "唾" "椭" "砣" "驮" "沱" "跎" "坨" "鸵" "乇" "鼍" "橐" "佗" "庹" "铊" "酡" "柁" "柝" "箨")
    ("wa" "瓦" "挖" "袜" "娃" "哇" "凹" "娲" "蛙" "洼" "佤" "腽")
    ("wai" "外" "歪" "崴")
    ("wan" "万" "完" "晚" "湾" "玩" "碗" "弯" "挽" "顽" "腕" "婉" "惋" "宛" "丸" "蜿" "莞" "畹" "剜" "豌" "皖" "纨" "琬" "脘" "烷" "芄" "菀" "绾")
    ("wang" "望" "王" "往" "网" "忘" "亡" "汪" "旺" "枉" "妄" "惘" "罔" "尢" "辋" "魍")
    ("wei" "为" "位" "未" "委" "维" "味" "围" "卫" "威" "微" "伟" "谓" "唯" "危" "慰" "尾" "违" "魏" "玮" "蔚" "伪" "畏" "胃" "喂" "炜" "韦" "惟" "巍" "纬" "萎" "娓" "苇" "尉" "帷" "渭" "猥" "偎" "薇" "痿" "猬" "逶" "帏" "韪" "煨" "鲔" "桅" "潍" "隈" "圩" "囗" "诿" "隗" "崴" "洧" "葳" "嵬" "闱" "沩" "涠" "艉" "軎")
    ("wen" "文" "问" "闻" "温" "稳" "吻" "纹" "蚊" "雯" "紊" "瘟" "汶" "刎" "阌" "璺")
    ("weng" "翁" "瓮" "嗡" "蓊" "蕹")
    ("wo" "我" "握" "窝" "卧" "渥" "沃" "涡" "斡" "蜗" "幄" "喔" "倭" "挝" "莴" "肟" "硪" "龌")
    ("wu" "无" "五" "物" "务" "武" "午" "舞" "於" "误" "恶" "吴" "屋" "伍" "悟" "吾" "污" "乌" "雾" "侮" "捂" "巫" "毋" "呜" "诬" "勿" "梧" "坞" "戊" "兀" "唔" "晤" "芜" "鹜" "钨" "妩" "痦" "鹉" "忤" "寤" "骛" "邬" "牾" "鼯" "圬" "浯" "仵" "阢" "芴" "庑" "婺" "怃" "杌" "焐" "蜈" "迕" "鋈")
    ("xi" "西" "系" "息" "希" "喜" "席" "习" "细" "戏" "吸" "洗" "惜" "稀" "悉" "析" "夕" "牺" "袭" "昔" "熙" "兮" "溪" "隙" "嘻" "锡" "晰" "媳" "樨" "熄" "膝" "郗" "犀" "禧" "曦" "奚" "羲" "蹊" "唏" "淅" "嬉" "皙" "汐" "徙" "茜" "玺" "熹" "烯" "翕" "蟋" "屣" "檄" "浠" "僖" "穸" "蜥" "隰" "觋" "螅" "铣" "菥" "葸" "蓰" "舾" "矽" "粞" "硒" "醯" "欷" "鼷" "歙" "饩" "阋" "禊" "舄")
    ("xia" "下" "夏" "吓" "峡" "厦" "侠" "狭" "霞" "瞎" "暇" "虾" "唬" "辖" "遐" "匣" "黠" "瑕" "呷" "狎" "柙" "硖" "瘕" "罅")
    ("xian" "现" "先" "显" "线" "险" "限" "县" "鲜" "献" "闲" "宪" "陷" "贤" "仙" "嫌" "咸" "羡" "掀" "弦" "纤" "娴" "衔" "馅" "涎" "舷" "腺" "跣" "暹" "岘" "猃" "蚬" "筅" "跹" "莶" "锨" "鹇" "痫" "铣" "氙" "祆" "籼" "冼" "藓" "酰" "苋" "燹" "霰")
    ("xiang" "想" "相" "向" "象" "香" "乡" "像" "响" "项" "享" "降" "箱" "详" "祥" "巷" "厢" "湘" "橡" "翔" "镶" "飨" "襄" "饷" "骧" "葙" "庠" "鲞" "芗" "缃" "蟓")
    ("xiao" "小" "笑" "校" "消" "效" "晓" "销" "潇" "肖" "萧" "孝" "宵" "削" "嚣" "啸" "逍" "硝" "霄" "淆" "哮" "枭" "骁" "箫" "筱" "哓" "枵" "绡" "魈" "蛸" "崤")
    ("xie" "些" "写" "谢" "协" "鞋" "携" "斜" "泄" "胁" "歇" "谐" "邪" "械" "屑" "卸" "挟" "懈" "泻" "亵" "蟹" "偕" "邂" "榭" "撷" "楔" "瀣" "蝎" "颉" "勰" "薤" "燮" "躞" "缬" "獬" "绁" "廨" "榍" "渫")
    ("xin" "心" "新" "信" "欣" "辛" "薪" "馨" "鑫" "芯" "衅" "昕" "忻" "锌" "歆" "镡" "囟")
    ("xing" "行" "性" "形" "兴" "星" "型" "姓" "幸" "刑" "醒" "腥" "杏" "悻" "惺" "邢" "猩" "荇" "擤" "荥" "饧" "硎" "陉")
    ("xiong" "雄" "兄" "胸" "凶" "熊" "匈" "汹" "芎")
    ("xiu" "修" "休" "秀" "袖" "宿" "臭" "羞" "绣" "朽" "锈" "嗅" "咻" "貅" "髹" "馐" "庥" "鸺" "岫" "溴")
    ("xu" "许" "续" "需" "须" "徐" "序" "虚" "绪" "吁" "蓄" "叙" "畜" "嘘" "恤" "絮" "浒" "墟" "旭" "婿" "栩" "戌" "诩" "胥" "酗" "煦" "砉" "盱" "糈" "醑" "顼" "勖" "洫" "溆" "圩" "蓿")
    ("xuan" "选" "宣" "旋" "悬" "券" "喧" "轩" "玄" "炫" "渲" "绚" "眩" "萱" "漩" "暄" "璇" "谖" "铉" "儇" "痃" "泫" "煊" "楦" "癣" "碹" "揎" "镟")
    ("xue" "学" "血" "雪" "削" "穴" "谑" "靴" "薛" "踅" "噱" "泶" "鳕")
    ("xun" "寻" "询" "训" "迅" "讯" "巡" "逊" "循" "旬" "熏" "勋" "驯" "荤" "殉" "醺" "巽" "徇" "埙" "荀" "峋" "洵" "薰" "汛" "郇" "曛" "窨" "恂" "獯" "浔" "鲟" "蕈" "浚")
    ("ya" "亚" "压" "雅" "牙" "呀" "押" "涯" "讶" "鸦" "哑" "鸭" "崖" "丫" "芽" "衙" "轧" "痖" "睚" "娅" "蚜" "伢" "疋" "岈" "琊" "垭" "揠" "迓" "桠" "氩" "砑")
    ("yan" "眼" "言" "严" "演" "研" "烟" "验" "延" "沿" "掩" "颜" "厌" "炎" "燕" "阎" "宴" "盐" "咽" "岩" "雁" "焰" "艳" "焉" "淹" "衍" "阉" "奄" "谚" "俨" "檐" "蜒" "彦" "腌" "焱" "晏" "唁" "妍" "砚" "嫣" "胭" "湮" "筵" "堰" "赝" "餍" "鼹" "芫" "偃" "魇" "闫" "崦" "厣" "剡" "恹" "阏" "兖" "郾" "琰" "罨" "鄢" "谳" "滟" "阽" "鼽" "酽" "菸")
    ("yang" "样" "洋" "阳" "央" "杨" "养" "扬" "仰" "羊" "痒" "漾" "泱" "氧" "鸯" "秧" "殃" "恙" "疡" "烊" "佯" "鞅" "怏" "徉" "炀" "蛘")
    ("yao" "要" "摇" "药" "耀" "遥" "邀" "腰" "姚" "咬" "尧" "谣" "瑶" "窑" "夭" "肴" "妖" "吆" "钥" "侥" "杳" "窈" "鹞" "曜" "舀" "铫" "幺" "爻" "徭" "繇" "鳐" "珧" "轺" "崾")
    ("ye" "也" "业" "夜" "爷" "叶" "野" "页" "液" "耶" "咽" "曳" "拽" "揶" "噎" "烨" "冶" "椰" "掖" "腋" "谒" "邺" "靥" "晔" "铘")
    ("yi" "一" "以" "意" "已" "义" "议" "医" "易" "衣" "艺" "依" "译" "移" "异" "益" "亦" "亿" "疑" "遗" "忆" "宜" "椅" "伊" "仪" "谊" "抑" "翼" "矣" "役" "艾" "乙" "溢" "毅" "蛇" "裔" "逸" "姨" "夷" "轶" "怡" "蚁" "弈" "倚" "翌" "颐" "疫" "绎" "彝" "咦" "佚" "奕" "熠" "贻" "漪" "诣" "迤" "弋" "懿" "呓" "驿" "咿" "揖" "旖" "屹" "痍" "薏" "噫" "镒" "刈" "沂" "臆" "缢" "邑" "胰" "猗" "羿" "钇" "舣" "劓" "仡" "酏" "佾" "埸" "诒" "圯" "荑" "壹" "挹" "嶷" "饴" "嗌" "峄" "怿" "悒" "铱" "欹" "殪" "黟" "苡" "肄" "镱" "瘗" "癔" "翊" "蜴" "眙" "翳")
    ("yin" "因" "音" "引" "印" "银" "隐" "饮" "阴" "姻" "瘾" "吟" "寅" "殷" "淫" "茵" "荫" "尹" "蚓" "垠" "喑" "湮" "胤" "鄞" "氤" "霪" "圻" "铟" "狺" "吲" "夤" "堙" "龈" "洇" "茚" "窨")
    ("ying" "应" "英" "影" "营" "迎" "硬" "映" "赢" "盈" "颖" "鹰" "婴" "蝇" "樱" "莹" "荧" "膺" "萤" "萦" "莺" "罂" "瀛" "楹" "缨" "颍" "嬴" "鹦" "瑛" "茔" "嘤" "璎" "荥" "撄" "郢" "瘿" "蓥" "滢" "潆" "媵")
    ("yo" "哟" "唷")
    ("yong" "用" "永" "拥" "勇" "涌" "踊" "泳" "庸" "佣" "咏" "俑" "雍" "恿" "甬" "臃" "邕" "镛" "痈" "壅" "鳙" "饔" "喁" "墉" "蛹" "慵")
    ("you" "有" "又" "由" "友" "游" "右" "油" "优" "邮" "幽" "尤" "忧" "犹" "悠" "幼" "诱" "佑" "黝" "攸" "呦" "酉" "柚" "鱿" "莠" "囿" "鼬" "铀" "卣" "猷" "牖" "铕" "疣" "蚰" "蝣" "釉" "蝤" "繇" "莜" "侑" "莸" "宥" "蚴" "尢")
    ("yu" "于" "与" "语" "育" "余" "遇" "狱" "雨" "於" "欲" "预" "予" "鱼" "玉" "愈" "域" "誉" "吁" "宇" "寓" "豫" "愚" "舆" "粥" "郁" "喻" "羽" "娱" "裕" "愉" "禹" "浴" "馀" "御" "逾" "渔" "渝" "俞" "萸" "瑜" "隅" "驭" "迂" "揄" "圄" "谕" "榆" "屿" "淤" "毓" "虞" "禺" "谀" "妪" "腴" "峪" "竽" "芋" "妤" "臾" "欤" "龉" "觎" "盂" "昱" "煜" "熨" "燠" "窬" "蝓" "嵛" "狳" "伛" "俣" "舁" "圉" "庾" "菀" "蓣" "饫" "阈" "鬻" "瘐" "窳" "雩" "瘀" "纡" "聿" "钰" "鹆" "鹬" "蜮")
    ("yuan" "员" "元" "原" "院" "远" "愿" "园" "源" "圆" "怨" "缘" "援" "冤" "袁" "渊" "苑" "猿" "鸳" "辕" "垣" "媛" "沅" "橼" "芫" "爰" "螈" "鼋" "眢" "圜" "鸢" "箢" "塬" "垸" "掾" "瑗")
    ("yue" "月" "乐" "越" "约" "阅" "跃" "曰" "悦" "岳" "粤" "钥" "刖" "瀹" "栎" "樾" "龠" "钺")
    ("yun" "运" "云" "允" "韵" "晕" "孕" "匀" "蕴" "酝" "筠" "芸" "耘" "陨" "纭" "殒" "愠" "氲" "狁" "熨" "郓" "恽" "昀" "韫" "郧")
    ("za" "杂" "扎" "砸" "咋" "咂" "匝" "拶")
    ("zai" "在" "再" "载" "灾" "仔" "宰" "哉" "栽" "崽" "甾")
    ("zan" "咱" "赞" "暂" "攒" "簪" "糌" "瓒" "拶" "昝" "趱" "錾")
    ("zang" "藏" "脏" "葬" "赃" "臧" "锗" "奘" "驵")
    ("zao" "早" "造" "遭" "糟" "澡" "灶" "躁" "噪" "凿" "枣" "皂" "燥" "蚤" "藻" "缲" "唣")
    ("ze" "则" "责" "泽" "择" "咋" "啧" "仄" "迮" "笮" "箦" "舴" "帻" "赜" "昃")
    ("zei" "贼")
    ("zen" "怎" "谮")
    ("zeng" "增" "赠" "憎" "缯" "罾" "甑" "锃")
    ("zha" "炸" "扎" "咋" "诈" "乍" "眨" "渣" "札" "栅" "轧" "闸" "榨" "喳" "揸" "柞" "楂" "哳" "吒" "铡" "砟" "齄" "咤" "痄" "蚱")
    ("zhai" "摘" "债" "宅" "窄" "斋" "寨" "翟" "砦" "瘵")
    ("zhan" "战" "展" "站" "占" "沾" "斩" "辗" "粘" "盏" "崭" "瞻" "绽" "蘸" "湛" "詹" "毡" "栈" "谵" "搌" "旃")
    ("zhang" "长" "张" "章" "丈" "掌" "涨" "帐" "障" "账" "胀" "仗" "杖" "彰" "璋" "蟑" "樟" "瘴" "漳" "嶂" "鄣" "獐" "仉" "幛" "嫜")
    ("zhao" "着" "找" "照" "招" "朝" "赵" "召" "罩" "兆" "昭" "肇" "沼" "诏" "钊" "啁" "棹" "笊")
    ("zhe" "这" "着" "者" "折" "哲" "浙" "遮" "辙" "辄" "谪" "蔗" "蛰" "褶" "鹧" "锗" "磔" "摺" "蜇" "赭" "柘")
    ("zhen" "真" "阵" "镇" "震" "针" "珍" "圳" "振" "诊" "枕" "斟" "贞" "侦" "赈" "甄" "臻" "箴" "疹" "砧" "桢" "缜" "畛" "轸" "胗" "稹" "祯" "浈" "溱" "蓁" "椹" "榛" "朕" "鸩")
    ("zheng" "政" "正" "证" "整" "争" "征" "挣" "郑" "症" "睁" "徵" "蒸" "怔" "筝" "拯" "铮" "峥" "狰" "诤" "鲭" "钲" "帧")
    ("zhi" "之" "只" "知" "至" "制" "直" "治" "指" "支" "志" "职" "致" "值" "织" "纸" "止" "质" "执" "智" "置" "址" "枝" "秩" "植" "旨" "滞" "徵" "帜" "稚" "挚" "汁" "掷" "殖" "芝" "吱" "肢" "脂" "峙" "侄" "窒" "蜘" "趾" "炙" "痔" "咫" "芷" "栉" "枳" "踯" "桎" "帙" "栀" "祉" "轾" "贽" "痣" "豸" "卮" "轵" "埴" "陟" "郅" "黹" "忮" "彘" "骘" "酯" "摭" "絷" "跖" "膣" "雉" "鸷" "胝" "蛭" "踬" "祗" "觯")
    ("zhong" "中" "种" "重" "众" "终" "钟" "忠" "衷" "肿" "仲" "锺" "踵" "盅" "冢" "忪" "舯" "螽")
    ("zhou" "周" "州" "洲" "粥" "舟" "皱" "骤" "轴" "宙" "咒" "昼" "肘" "帚" "胄" "纣" "诌" "绉" "妯" "碡" "啁" "荮" "籀" "繇" "酎")
    ("zhu" "主" "住" "注" "助" "著" "逐" "诸" "朱" "驻" "珠" "祝" "猪" "筑" "竹" "煮" "嘱" "柱" "烛" "铸" "株" "瞩" "蛛" "伫" "拄" "贮" "洙" "诛" "褚" "铢" "箸" "蛀" "茱" "炷" "躅" "竺" "杼" "翥" "渚" "潴" "麈" "槠" "橥" "苎" "侏" "瘃" "疰" "邾" "舳")
    ("zhua" "抓" "爪")
    ("zhuai" "拽" "嘬")
    ("zhuan" "传" "专" "转" "赚" "撰" "砖" "篆" "啭" "馔" "颛")
    ("zhuang" "装" "状" "壮" "庄" "撞" "妆" "幢" "桩" "奘" "僮" "戆")
    ("zhui" "追" "坠" "缀" "锥" "赘" "隹" "椎" "惴" "骓" "缒")
    ("zhun" "准" "谆" "窀" "肫")
    ("zhuo" "着" "桌" "捉" "卓" "琢" "灼" "酌" "拙" "浊" "濯" "茁" "啄" "斫" "镯" "涿" "焯" "浞" "倬" "禚" "诼" "擢")
    ("zi" "子" "自" "字" "资" "咨" "紫" "滋" "仔" "姿" "吱" "兹" "孜" "梓" "渍" "籽" "姊" "恣" "滓" "谘" "龇" "秭" "呲" "辎" "锱" "眦" "笫" "髭" "淄" "茈" "觜" "訾" "缁" "耔" "鲻" "嵫" "赀" "孳" "粢" "趑")
    ("zong" "总" "宗" "纵" "踪" "综" "棕" "粽" "鬃" "偬" "腙" "枞")
    ("zou" "走" "奏" "邹" "揍" "驺" "鲰" "诹" "陬" "鄹")
    ("zu" "组" "足" "族" "祖" "租" "阻" "卒" "诅" "俎" "镞" "菹")
    ("zuan" "赚" "钻" "攥" "纂" "躜" "缵")
    ("zui" "最" "罪" "嘴" "醉" "咀" "觜" "蕞")
    ("zun" "尊" "遵" "樽" "鳟" "撙")
    ("zuo" "作" "做" "坐" "座" "左" "昨" "琢" "佐" "凿" "撮" "柞" "嘬" "怍" "胙" "唑" "笮" "阼" "祚" "酢")))

(defvar org-plain-link-re)

(defun org2nikola--zh-char-to-pinyin (ch)
  "Convert Chinese character CH to pinyin."
  (catch 'break
    (let* ((i 0)
           item
           (s (char-to-string ch)))
      (while (< i (length org2nikola-zh-char-table))
        (setq item (nth i org2nikola-zh-char-table))
        (if (member s (cdr item))
            (throw 'break (car item)))
        (setq i (1+ i))))))

(defun org2nikola--char-to-string (ch)
  "Convert character CH to string."
  (let* ((chspc 32)
         (chsq 39)
         (ch0 48)
         (ch9 57)
         (cha 97)
         (chz 122)
         (chA 65)
         (chZ 90)
         (chdot 46)
         (chminus 45)
         (chunderscore 95)
         (cjk-min 19968)
         (cjk-max 40959)
         rlt)
    (cond
     ((or (and (<= ch0 ch) (<= ch ch9))
          (and (<= cha ch) (<= ch chz))
          (and (<= chA ch) (<= ch chZ))
          (= chunderscore ch)
          (= chminus ch)
          )
      (setq rlt (char-to-string ch)))
     ((and (<= cjk-min ch) (<= ch cjk-max))
      (setq rlt (concat "-" (org2nikola--zh-char-to-pinyin ch) "-"))
      )
     ((or (= chspc ch) (= chsq ch) (= chdot ch))
      (setq rlt "-")))
    rlt))

(defun org2nikola-get-slug (str)
  "Get post slug from STR."
  (setq str (mapconcat 'org2nikola--char-to-string str ""))
  ;; clean slug little bit
  (setq str (replace-regexp-in-string "\-\-+" "-" str))
  (setq str (replace-regexp-in-string "^\-+" "" str))
  (setq str (string-trim (replace-regexp-in-string "\-+$" "" str)))
  (setq str (downcase str))
  str)

(defun org2nikola-line ()
  "Get current line content."
  (buffer-substring-no-properties (line-beginning-position) (line-end-position)))

(defun org2nikola-select-region (begin end)
  "Select region between BEGIN and END."
  (goto-char begin)
  (set-mark-command nil)
  (goto-char end)
  (setq deactivate-mark nil))

(defun org2nikola-export-into-html-text ()
  "Export current org element into html."
  (let* (html-text
         cur-line
         ;; Emacs 25+ prefer exporting drawer by default
         ;; obviously not acception in exporting to mail body
         (org-export-with-drawers nil)
         b
         e)
    (save-excursion
      (org-mark-element)
      ;; donot export title
      (forward-line)
      ;; skip attributes
      (while (string-match-p "^ *:[A-Z_]+:" (org2nikola-line))
        (forward-line))
      (setq b (line-beginning-position))
      (setq e (region-end)))

    ;; org-export-as will detect active region and narrow to the region
    (save-excursion
      (org2nikola-select-region b e)
      (setq html-text
            (cond
             ((version-list-< (version-to-list (org-version)) '(8 0 0))
              (if (fboundp 'org-export-region-as-html)
                  (org-export-region-as-html b e t 'string)))
             (t
              (if (fboundp 'org-export-as)
                  (org-export-as 'html t nil t))))))
    html-text))

(defun org2nikola-fix-unsupported-language (lang)
  "Fix supported language LANG by code prettifier."
  (if (plist-get org2nikola-prettify-unsupported-language (intern lang))
      (setq lang (plist-get org2nikola-prettify-unsupported-language (intern lang))))
  lang)

(defun org2nikola-guess-output-html-directory ()
  "Guess the directory to place output html file."
  (let* ((rlt (concat (file-name-as-directory org2nikola-output-root-directory)
                      "posts")))
    (if (not (file-exists-p (expand-file-name rlt)))
        (make-directory (expand-file-name rlt)))
    (file-name-as-directory rlt)))

(defun org2nikola-guess-output-image-directory ()
  "Guess the directory to place image."
  (let* ((rlt (concat (file-name-as-directory org2nikola-output-root-directory)
                      "files/wp-content")))
    (if (not (file-exists-p (expand-file-name rlt)))
        (make-directory (expand-file-name rlt)))
    (file-name-as-directory rlt)))

(defun org2nikola-get-full-url (local-file org-directory)
  "Get full url from LOCAL-FILE and ORG-DIRECTORY."
  (let* ((source-file-full-path (file-truename (concat org-directory local-file)))
         (dst-file-full-path (concat
                              (org2nikola-guess-output-image-directory)
                              (file-name-nondirectory source-file-full-path)))
         (final-url (concat "/wp-content/" (file-name-nondirectory local-file))))
    (cond
     ((file-exists-p source-file-full-path)
      (copy-file source-file-full-path dst-file-full-path t))
     (t
      (setq final-url nil)))
    final-url))

(defun org2nikola-replace-url (text org-directory)
  "Render media file in HTML and update it link using TEXT and ORG-DIRECTORY."
  (let* (file-all-urls
         file-name
         file-web-url
         beg
         (file-regexp "<a href=\"\\(.?*\\)\"\\|<img src=\"\\(.*?\\)\""))
    (save-excursion
      (while (string-match file-regexp text beg)
        (setq file-name
              (if (match-beginning 1)
                  (substring text (match-beginning 1) (match-end 1))
                (substring text (match-beginning 2) (match-end 2))))
        (setq file-name (save-match-data (if (string-match "^file:" file-name)
                                             (substring file-name 7)
                                           file-name)))
        (setq beg (match-end 0))
        ;; file-name could be a link to a tag
        (when (and (save-match-data (not (or (string-match org-plain-link-re file-name)
                                             (string-match "^#" file-name)
                                             (string-equal (file-name-nondirectory file-name) ""))))
                   (setq file-web-url (org2nikola-get-full-url file-name org-directory)))
          (setq file-all-urls
                (append file-all-urls (list (cons
                                             file-name file-web-url))))))
      ;; replace url in file-all-urls
      (dolist (file file-all-urls)
        (setq text (replace-regexp-in-string
                    (concat "\\(<a href=\"\\|<img src=\"\\)\\(file://\\)*"
                            (regexp-quote (car file))
                            "\\(\" +alt=\"\\).*$")
                    (concat "\\1"
                            (cdr file)
                            "\\3"
                            (file-name-nondirectory
                             (cdr file))
                            "\" />")
                    text))))
    text))

(defun org2nikola-replace-pre (html)
  "Replace pre blocks with source code shortcode blocks in HTML.
Shamelessly copied from org2blog/wp-replace-pre()."
  (save-excursion
    (let* (pos code lang info params header code-start code-end html-attrs pre-class)
      (with-temp-buffer
        (insert html)
        (goto-char (point-min))
        (save-match-data
          (while (re-search-forward "<pre\\(.*?\\)>" nil t 1)

            ;; When the code block is a src_block
            (unless
                (save-match-data
                  (setq pre-class (match-string-no-properties 1))
                  (string-match "example" pre-class))
              ;; Replace the <pre...> text
              (setq lang (replace-regexp-in-string ".*src-\\([a-zA-Z0-9]+\\).*" "\\1" pre-class)  )

              (replace-match "")
              (setq code-start (point))

              ;; Go to end of code and remove </pre>
              (re-search-forward "</pre.*?>" nil t 1)
              (replace-match "")
              (setq code-end (point))
              (setq code (buffer-substring-no-properties code-start code-end))

              ;; Delete the code
              (delete-region code-start code-end)
              ;; Stripping out all the code highlighting done by htmlize
              (setq code (replace-regexp-in-string "<.*?>" "" code))
              ;; default is highlight.js, it's the best!
              (insert (concat "\n<pre><code class=\"lang-"
                              (org2nikola-fix-unsupported-language lang)
                              "\">"
                              code
                              "</code></pre>\n")))))
        ;; Get the new html!
        (setq html (buffer-substring-no-properties (point-min) (point-max))))))
  html)

(defun org2nikola-format-time-string ()
  "UTC time string."
  (format-time-string "%Y-%m-%d %T" (org-current-time) t))

(defun org2nikola--existing-slug ()
  "Return post slug or nil."
  (let* ((post-slug (org-entry-get (point) "POST_SLUG")))
    (if (and post-slug (< 0 (length post-slug)))
        post-slug)))

(defun org2nikola--render-subtree (&optional donot-publish)
  "Render current subtree and publish post if DONOT-PUBLISH is nil."
  ;; htmlize requires to to access hl-line's font faces when rendering diff
  (unless (featurep 'hl-line) (require 'hl-line))

  (let* ((org-directory default-directory)
         html-file
         ;; set title and tags
         (title (nth 4 (org-heading-components)))
         (tags (mapcar 'org-no-properties (org-get-tags-at (point) nil)))
         (post-slug (org2nikola--existing-slug))
         (meta-file (concat (file-name-as-directory (org2nikola-guess-output-html-directory))
                            post-slug
                            ".meta"))
         (html-file (concat (file-name-as-directory (org2nikola-guess-output-html-directory))
                            post-slug
                            ".wp"))
         ;; set POST_DATE if it does not exist
         (post-date (org-entry-get (point) "POST_DATE"))
         ;; set UPDATE_DATE always! Use full ISO 8601 format
         (update-date (org2nikola-format-time-string))
         html-text)
    (unless (and post-date (< 8 (length post-date)))
      ;; full ISO 8601 format
      (setq post-date (org2nikola-format-time-string))
      (org-entry-put (point) "POST_DATE" post-date))

    (org-entry-put (point) "UPDATE_DATE" update-date)

    ;; set POST_SLUG if its does not exist
    (unless post-slug
      (setq post-slug (org2nikola-get-slug title))
      (org-entry-put (point) "POST_SLUG" post-slug))

    ;; meta file
    (with-temp-file meta-file
      (insert (format (if org2nikola-use-verbose-metadata ".. title: %s\n.. slug: %s\n.. date: %s\n.. tags: %s"
                        "%s\n%s\n%s\n%s")
                      title
                      post-slug
                      post-date
                      (mapconcat 'identity tags ","))))

    ;; html file
    (setq html-text (org2nikola-export-into-html-text))

    (save-excursion
      (setq html-text (org2nikola-replace-pre html-text)))
    ;; post content should NOT contain title
    ;; both org 8 and org 9
    (setq html-text (replace-regexp-in-string (format "<h[23] .*%s.*" title) "" html-text))
    ;; org 8
    (setq html-text (replace-regexp-in-string "<h[23]  *id=\"sec-1\">.*" "" html-text))
    ;; org 9
    (setq html-text (replace-regexp-in-string "<h[23] .*class=\"section-number-2\".*" "" html-text))
    (setq html-text (org2nikola-replace-url html-text org-directory))

    (with-temp-file html-file
      (insert (funcall org2nikola-process-output-html-function html-text title post-slug)))

    (unless donot-publish
      (run-hook-with-args 'org2nikola-after-hook title post-slug))))

;;;###autoload
(defun org2nikola-export-subtree ()
  "Export current first level subtree into HTML."
  (interactive)
  ;; just goto the root element
  (condition-case nil
      (outline-up-heading 8)
    (error
     (message "at the beginning ...")))

  ;; nikola root directory must exist
  (unless (and org2nikola-output-root-directory (file-directory-p org2nikola-output-root-directory))
    (setq org2nikola-output-root-directory (read-directory-name "Nikola root directory:")))

  ;; should be nil
  (org2nikola--render-subtree))

;;;###autoload
(defun org2nikola-rerender-published-posts ()
  "Re-render all old published posts."
  (interactive)
  (unless (and org2nikola-org-blog-directory
               (file-directory-p org2nikola-org-blog-directory))
    (setq org2nikola-org-blog-directory
          (read-directory-name "Org blog directory:")))

  (dolist (f (directory-files org2nikola-org-blog-directory t))
    (when (and (not (file-directory-p f))
               (string-match-p "\.org$" f))
      ;; need setup default-directory to get absolute path of image embedded in org file
      (let* ((default-directory (file-name-directory f)))
        (with-temp-buffer
          ;; need make sure is org-mode is load loaded
          (insert-file-contents f)
          (org-mode)
          (goto-char (point-min))
          (while (search-forward-regexp "^\* [^ ]+" (point-max) t)
            (if (org2nikola--existing-slug)
                (org2nikola--render-subtree t))))))))

(provide 'org2nikola)
;;; org2nikola.el ends here
